#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

############## 下载git项目  #####################
FROM bitnami/git:2.34.0 as git-download
MAINTAINER biebbwa@163.com
ARG GIE_HOME
ENV GIE_HOME=${GIE_HOME}
WORKDIR /home
RUN git clone $GIE_HOME


FROM bitnami/dotnet:5 AS base
WORKDIR /app

FROM bitnami/dotnet-sdk:5 AS build
COPY --from=git-download  /home/blizzless-diiis/src /home/src
WORKDIR /home/src

RUN dotnet restore "DiIiS-NA/Blizzless.csproj" \
    && dotnet build "DiIiS-NA/Blizzless.csproj" -c Release -o /app/build \
    && dotnet publish "DiIiS-NA/Blizzless.csproj" -c Release -o /app/publish /p:UseAppHost=false


FROM base AS d3-server
WORKDIR /app
COPY --from=build /app/publish .
COPY wait-for-it.sh /usr/local/bin
RUN  chmod +x /usr/local/bin/wait-for-it.sh
ENTRYPOINT wait-for-it.sh postgres:5432 -s -t 0 -- dotnet Blizzless.dll